<template>
    <WordCloud :words="words" :color="([, weight]) => weight > 0.3 ? '#3498db' : '#2ecc71'"
        font-family="Microsoft YaHei" :spacing="0.5" @word-click="handleWordClick" />
</template>

<script setup>
import { WordCloud } from 'vue3-word-cloud';


const handleWordClick = (word, event) => {
    console.log('点击词汇:', word.text, '权重:', word.value);
};
</script>

<style scoped>
/* 容器响应式 */
.word-cloud-container {
    width: 100%;
    height: 60vh;
    min-height: 400px;
}
</style>